using Core.CSV;
using Game.WeaponComponent;

namespace Game {
    public class DoubleSpawnEffect : WeaponEffect
    {
        public DoubleSpawnEffect(TBWeaponEffectConfig config) : base(config) {
        }

        protected override void onAttach() {
            base.onAttach();
            if (mAttachCombinant.Has<BaseSpawnerComponent>()) {
                var components = mAttachCombinant.GetAll<BaseSpawnerComponent>();
                foreach (var component in components) {
                    component.SpawnNum *= 2;
                }
            }
        }


        protected override void onDetach() {
            base.onDetach();
            if (mAttachCombinant.Has<BaseSpawnerComponent>()) {
                var components = mAttachCombinant.GetAll<BaseSpawnerComponent>();
                foreach (var component in components) {
                    component.SpawnNum /= 2;
                }
            }
        }
        
    }
}
